import asyncio


async def task_function():
    raise ValueError("An error occurred")


async def main():
    task = asyncio.create_task(task_function())
    await asyncio.sleep(0.1)  # 确保task_function运行完成
    print(f"-----task: {task.done()}")
    # if task.exception() is not None:
    #     print(f"Exception: {task.exception()}")
    # else:
    #     print("No exception")


asyncio.run(main())
